<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>会员登录页面</title>

<script type="text/javascript" src="../../static/script/jquery-1.7.2.js"></script>
<script type="text/javascript">
	// 页面加载完成之后
	$(function(){
		
		// 给注册按钮添加事件
		$("#sub_btn").click(function(){
			$.ajax({
				url:"/spring_mybatis_book/user/login",
				type : "POST",
				data : {
					"username" : $("#username").val(),
					"password" : $("#password").val()
				},
				dataType :"json",
				success : function (resp) {
					if(resp.code == 200){
						//成功,跳转到主页
						window.location.href ="./login_success.html";
					}else{
						//失败提示下
						alert(resp.msg);
					}
				}
			});

			// 阻止表单提交
			return true;
		});
		
	});

</script>

<link type="text/css" rel="stylesheet" href="../../static/css/style.css" >
</head>
<body>
		<div id="login_header">
			<img class="logo_img" alt="" src="../../static/img/logo.gif" >
		</div>
		
			<div class="login_banner">
			
				<div id="l_content">
					<span class="login_word">欢迎登录</span>
				</div>
				
				<div id="content">
					<div class="login_form">
						<div class="login_box">
							<div class="tit">
								<h1>商城会员</h1>
								<a href="regist.html">立即注册</a>
							</div>
							<div class="msg_cont">
								<b></b>
								<span class="errorMsg">请输入用户名和密码</span>
							</div>
							<div class="form">
								<form action="/book/loginServlet" method="post">
									<label>用户名称：</label>
									<input class="itxt" type="text" placeholder="请输入用户名" autocomplete="off" 
										tabindex="1" name="username" id="username"/>
									<br />
									<br />
									<label>用户密码：</label>
									<input class="itxt" type="password" placeholder="请输入密码" autocomplete="off" 
									 	tabindex="1" name="password" id="password"
									/>
									<br />
									<br />
									<input type="button" value="登录" id="sub_btn" />
								</form>
							</div>
							
						</div>
					</div>
				</div>
			</div>
		<div id="bottom">
			<span>
				三体网上书城.Copyright &copy;2020
			</span>
		</div>
</body>
</html>